/***********************************************************************
 * Module:  TopicShortcut.java
 * Author:  DAC
 * Purpose: Defines the Class TopicShortcut
 ***********************************************************************/
package com.group1.model;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;

/** @pdOid 33637f66-8503-4d5d-919b-3daf4465dee5 */
public class TopicShortcut {
   /** @pdOid 49e8486b-538e-48ed-8b14-9887bcca9a0f */
   private Integer topTopicID;
   
   /** @pdOid 9f8c87e7-beab-49c7-9055-1f5a82e88435 */
   protected void finalize() {
      // TODO: implement
   }
   
   /** @pdOid 65bde8e0-d6e7-460a-8cf4-76428d253756 */
   public Integer topicshortId;
   /** @pdOid 487eb97b-8610-495c-9863-b81f41083c6d */
   public java.lang.String topicshortNote;
   
   /** @pdRoleInfo migr=no name=Topic assc=shortcutToTopics mult=0..1 side=A */
   public Topic topic; //use
   /** @pdRoleInfo migr=no name=Topic assc=topicShortcutInsideATopic mult=0..1 side=A */
   public Topic topTopic;//use
   
   /** @param topicScID 
    * @param topicID 
    * @param topTopicId 
    * @param topicScNote
    * @pdOid 7c38ae24-73ac-423f-b1df-528fca695972 */
   public TopicShortcut(long topicScID, long topicID, long topTopicId, String topicScNote) {
      // TODO: implement
   }
   
 
   /** @param session
    * @pdOid 4822520f-a341-41bb-bd91-6bc0a19fbf2e */
   public static List<TopicShortcut> getAllTopicSC(Session session) {
      // TODO: implement
	   Query query = session.createQuery("from TopicShortcut");
	   List<TopicShortcut> list = query.list();
      return list;
   }
   
   /** @param topicSCID 
    * @param session
    * @pdOid 4bec9000-41b9-4b0b-9a9a-b6d4d6e0f6cd */
   public static TopicShortcut getToipicSCByID(Integer topicSCID, Session session) {
      // TODO: implement
      return (TopicShortcut) session.get(TopicShortcut.class, topicSCID);
   }
   
   /** @param topicID 
    * @param session
    * @pdOid 39236465-895c-4cff-8369-66ced9c1b07c */
   public static List<TopicShortcut> getTopicSCByTopic(Integer topicID, Session session) {
      // TODO: implement
	  Query query = session.createQuery("from TopicShortcut where TOPIC_ID = " + topicID);
	  List<TopicShortcut> list = query.list();
      return list;
   }
   
   /** @param topTopicID 
    * @param session
    * @pdOid af443f04-f932-409f-86ee-ffb74509744e */
   public static List<TopicShortcut> getTopicSCByTopTopic(Integer topTopicID, Session session) {
      // TODO: implement
	   Query query = session.createQuery("from TopicShortcut where TOP_TOPIC_ID = " + topTopicID);
	   List<TopicShortcut> list = query.list();
      return list;
   }
   
   /** @pdOid a33f835b-82be-4052-b580-3f56455b56d8 */
   public Integer getTopicshortId() {
      return topicshortId;
   }
   
   /** @param newTopicshortId
    * @pdOid 7dbe97b5-9914-43e2-92e5-a94b77e6079b */
   public void setTopicshortId(Integer newTopicshortId) {
      topicshortId = newTopicshortId;
   }
   
   /** @pdOid 332e9ef5-cb3b-46e5-8929-5f5beac050a5 */
   public java.lang.String getTopicshortNote() {
      return topicshortNote;
   }
   
   /** @param newTopicshortNote
    * @pdOid bdf3e839-2164-48ee-89f8-3d290b9029a9 */
   public void setTopicshortNote(java.lang.String newTopicshortNote) {
      topicshortNote = newTopicshortNote;
   }
   
   /** @pdOid 62e82e21-b272-4e4e-b190-f26c061d072f */
   public Integer getTopTopicID() {
      return topTopicID;
   }
   
   /** @param newTopTopicID
    * @pdOid 29c7ca51-e344-4476-8f9c-e4c0bfb965c3 */
   public void setTopTopicID(Integer newTopTopicID) {
      topTopicID = newTopTopicID;
   }
   
   /** @pdOid 0945e083-0d2a-4e58-9041-466dd2230332 */
   public TopicShortcut() {
      // TODO: implement
   }
   
   
   /** @pdGenerated default parent getter */
   public Topic getTopic() {
      return topic;
   }
   
   /** @pdGenerated default parent setter
     * @param newTopic */
   public void setTopic(Topic newTopic) {
      if (this.topic == null || !this.topic.equals(newTopic))
      {
         if (this.topic != null)
         {
            Topic oldTopic = this.topic;
            this.topic = null;
            oldTopic.removeTopicShortcut2(this);
         }
         if (newTopic != null)
         {
            this.topic = newTopic;
            this.topic.addTopicShortcut2(this);
         }
      }
   }
   /** @pdGenerated default parent getter */
   public Topic getTopTopic() {
      return topTopic;
   }
   
   /** @pdGenerated default parent setter
     * @param newTopic */
   public void setTopTopic(Topic newTopic) {
      if (this.topTopic == null || !this.topTopic.equals(newTopic))
      {
         if (this.topTopic != null)
         {
            Topic oldTopic = this.topTopic;
            this.topTopic = null;
            oldTopic.removeTopicShortcut(this);
         }
         if (newTopic != null)
         {
            this.topTopic = newTopic;
            this.topTopic.addTopicShortcut(this);
         }
      }
   }

}